package com.itheima.random;

import java.util.Random;
import java.util.Scanner;

public class RandomTest {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Random rd = new Random();
        int RandomNumber = rd.nextInt(100) + 1;


        while (true) {
            System.out.println("请输入一个数字:");
            int num = sc.nextInt();
            if (num == RandomNumber) {
                System.out.println("猜对了，你真棒！");
                break;
            } else if (num > RandomNumber) {
                System.out.println("太大了！");
            } else {
                System.out.println("太小了");
            }
        }
    }
}
